const http = function(t) {
    var o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, e = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "POST", a = "http://192.168.1.11", s = "", n = /(http|https):\/\/([\w.]+\/?)\S*/;
    s = n.test(t) ? t : a + t
	return  new Promise(function(t, a) {
        wx.request({
            url: s,
            method: e,
            data: o,
            header: {
                "Content-Type": "application/json",
                token: uni.getStorageSync("token") || ""
            },
            success: function(res) {
				if(res.data.code == 1){
					t(res.data)
				}else{
					uni.showToast({
						title:'接口有问题请检查',
						icon:'none'
					})
				}
            },
            fail: function(t) {
                console.log(t), wx.hideLoading(), 0 == t.data.code && wx.showToast({
                    title: t.data.msg
                }), a(t);
            }
        });
    });
};

export default http